package com.sale.system.mapper;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.sale.common.mybatis.core.mapper.BaseMapperPlus;
import com.sale.system.api.domain.SysBalance;
import com.sale.system.api.domain.dto.FinishAndRawDto;
import com.sale.system.domain.MaterialFinished;
import com.sale.system.domain.dto.MaterialFinishedDto;
import com.sale.system.domain.dto.ProjectRecursionDto;
import com.sale.system.domain.vo.MaterialFinishedVo;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * @Description 成品信息
 * @Date 23-07-13
 * @Author hl
 **/
public interface MaterialFinishedMapper extends BaseMapperPlus<MaterialFinishedMapper, MaterialFinished, MaterialFinished> {

    /**
     * 树结构
     */
    List<ProjectRecursionDto> selectChildrenFinishedThe();


    /**
     * 根据物料编码查询详情（成品信息）
     * @param materialCode
     * @return
     */
    MaterialFinished selectMaterialFinishedMaterialCode(String materialCode);

    /**
     * 根据id查询成品信息
     */
    String getFinishedById(@Param("materialIdList") List<String> materialIdList);


    /**
     * 查询成品信息
     */
    Page<MaterialFinishedDto> selectFinishedList(@Param("page") Page<MaterialFinishedVo> build, @Param(Constants.WRAPPER) Wrapper<MaterialFinishedVo> buildQueryWrapper);

    /**
     * 查询单个成品信息
     */
    MaterialFinishedDto selectFinishedById(long materialId);

    /**
     * 查询是否存在该物料
     * @param materialId
     * @return int
     */
    int selectCountMaterial(Long materialId);

    /**
     * 根据物料编码查询成品信息
     * @param materialCode
     * @return
     */
    MaterialFinishedDto getByFinishedMaterialCode(String materialCode);

    /**
     * 修改余额
     * @param sys
     * @return int
     */
    int editBalance(SysBalance sys);

    /**
     * 修改余额 -
     * @param sys
     * @return int
     */
    int editBalance2(SysBalance sys);

    /**
     * 查询成品信息
     * @param materialCode
     */
    FinishAndRawDto getFinishAndRaw(String materialCode);
}
